home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GETFAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  607 b   |  25 lines

  1. /* getfat.c --- p. 608 */
  2. #include <stdio.h>
  3. #include <dos.h>
  4. main()
  5. {
  6.     struct fatinfo fat;
  7.     unsigned char fatid;
  8.     long capacity;
  9. /* Get information from the FAT of current drive */
  10.     getfat(0, &fat);
  11.     printf("FAT of drive %c\n", getdisk()+'A');
  12.     fatid = fat.fi_fatid;
  13.     printf("Sectors per cluster %d\n"
  14.         "FAT ID         %X\n"
  15.         "Number of clusters %d\n"
  16.         "Bytes per sector:  %d\n",
  17.         fat.fi_sclus, fatid,
  18.         fat.fi_nclus, fat.fi_bysec);
  19.     capacity = (long)fat.fi_sclus *
  20.            (long)fat.fi_nclus *
  21.            (long)fat.fi_bysec;
  22.     printf("TOTAL CAPACITY:     %ld bytes\n", capacity);
  23. }
  24.  
  25.